#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/types.h>
int main(void)
{
    int fd[2]={0};
    pipe(fd);
    
    pid_t id = fork();
    if(id==0)
    {
        close(fd[0]);
        int count=0;
        char ch='c';
        while(1)
        {
            write(fd[1],&ch,1);
            count++;
            printf("count:%d\n",count);
        }
        return 1;
    }
    close(fd[1]);
    //close(fd[0]);
    int status;
    waitpid(id,&status,0);
    printf("signal:%d\n",status&0x7F);
    return 0;
    
}
